#!/bin/sh
set -o nounset
#set -x #DEBUG

cd $SCRIPT_BINDDIR
. bin/rootfs-library.sh

# Exit if nothing to do
exit_if_stamped $0
[ -n "$(ls config/install-pkgs.d)" ] || exit 0

prevent_services_running
export DEBIAN_FRONTEND=noninteractive

# Install packages listed in config/install-pkgs.d
printinfo Installing configured additional packages using proxy: $CONFIG_APT_PROXY
pkgs=`cat config/install-pkgs.d/*`
http_proxy=$CONFIG_APT_PROXY apt install -y $pkgs || die Package installation failure!

allow_services_to_run
updated_rootfs
make_stamp $0

exit 0
